package pl.edu.agh.neuraleconomy.persistence.simulation;

import java.util.List;

import pl.edu.agh.neuraleconomy.common.exception.ApplicationRuntimeException;
import pl.edu.agh.neuraleconomy.model.simulation.DailyHistory;
import pl.edu.agh.neuraleconomy.model.simulation.Transaction;
import pl.edu.agh.neuraleconomy.persistence.base.BaseDao;

public class TransactionDao extends BaseDao<Transaction>{

	public TransactionDao() {
		super(Transaction.class);
	}

	public List<Transaction> getForSimulation(Long simulationId){
		try{
			return dao.queryBuilder().orderBy(DailyHistory.DATE, true).where().eq(DailyHistory.SIMULATION_ID, simulationId).query();
		}catch(Exception e){
			logger.error("", e);
			throw new ApplicationRuntimeException(e);
		}
	}
}
